cmake_minimum_required(VERSION 3.8)
project(4_cpp_action)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic -g3 -O0)
endif()

find_package(ament_cmake REQUIRED)
find_package(common REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)

add_executable(31_member_functions_server src/31_member_functions_server.cpp)
ament_target_dependencies(31_member_functions_server
  "rclcpp"
  "rclcpp_action"
  "common")

add_executable(32_member_function_client src/32_member_function_client.cc)
ament_target_dependencies(32_member_function_client
  "rclcpp"
  "rclcpp_action"
  "common")

  add_executable(1_action_service src/1_action_service.cc)
  ament_target_dependencies(1_action_service
    "rclcpp"
    "rclcpp_action"
    "common")

  add_executable(2_action_client src/2_action_client.cc)
  ament_target_dependencies(2_action_client
    "rclcpp"
    "rclcpp_action"
    "common")

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

install(TARGETS
  31_member_functions_server
  32_member_function_client
  1_action_service
  2_action_client
  DESTINATION lib/${PROJECT_NAME})

ament_package()
